/*
 * @Description: 
 * @Author: ouyaping
 * @Date: 2023-04-11 14:20:44
 * @LastEditors: ouyaping
 * @LastEditTime: 2023-04-11 18:26:27
 */
import { Injectable, OnModuleInit } from '@nestjs/common';
import { GrpcClientFactory } from "grpcs/grpc-client.factory";
import { VA600Algorithm } from "grpcs";
import { join } from 'path';

@Injectable()
export class AppService implements OnModuleInit {
  onModuleInit() {
    this.adminServiceInterface = this.grpcClientFactory.userServiceClient.getService<VA600Algorithm.ProfessionalRunningPostureEvaluation>("ProfessionalRunningPostureEvaluation");
  }

  constructor(
      private readonly grpcClientFactory: GrpcClientFactory
  ) { }
  private adminServiceInterface: VA600Algorithm.ProfessionalRunningPostureEvaluation;

  async startAlg(): Promise<any> {
    await this.adminServiceInterface.startPreheat({ height: 180, weight: 140 }).toPromise();
    await this.adminServiceInterface.startProfessionalRunningPosture({ value: 0 }).toPromise();
    console.log('start alg')
    return 'start alg';
  }

  async endAlg(): Promise<any> {
    await this.adminServiceInterface.stopProfessionalRunningPosture({ value: 0 }).toPromise();
    console.log('end alg')
    return 'end alg';
  }
}
